import { PrismaClient } from "@prisma/client";
import dayjs from "dayjs";

const AGREEMENTS_USER_ID = "agreements";

const prisma = new PrismaClient();

async function main() {
  const agreements = await prisma.user.create({
    data: {
      id: AGREEMENTS_USER_ID,
      username: "Agremeents",
      createTime: dayjs("2023-12-03 11:22:33").toDate(),
      updateTime: dayjs("2023-12-03 11:22:33").toDate(),
    },
  });

  const a1 = await prisma.post.create({
    data: {
      id: "A1",
      title: "User Agreement",
      contentType: "md",
      content: "You should balabala...",
      personal: false,
      deleteTime: null,
      createTime: dayjs("2023-12-03 11:22:33").toDate(),
      updateTime: dayjs("2023-12-03 11:22:33").toDate(),
      authorId: AGREEMENTS_USER_ID,
    },
  });

  console.log({ agreements, a1 });
}

main()
  .then(async () => {
    await prisma.$disconnect();
  })
  .catch(async (e) => {
    console.error(e);
    await prisma.$disconnect();
    process.exit(1);
  });
